package genetica.cromosomas.factorias;

import java.util.ArrayList;
import java.util.Random;

import genetica.cromosomas.Cromosoma;
import genetica.cromosomas.CromosomaFuncion;
import genetica.cromosomas.evaluadores.evaluadorFuncionA;

public class factoriaFuncionA extends FactoriaFuncion{
	public factoriaFuncionA(double precision){
		super(precision);
	}
	@Override
	public CromosomaFuncion crea() {
		Random r = new Random();
		ArrayList<Double>xmin = new ArrayList<Double>();
		ArrayList<Double>xmax = new ArrayList<Double>();
		xmin.add(0.0);
		xmax.add(32.0);
		CromosomaFuncion c = new CromosomaFuncion(xmin,xmax,precision,r, new evaluadorFuncionA());
		return c;
	}

	@Override
	public Cromosoma copia(Cromosoma original) {
		if (original instanceof CromosomaFuncion)
			return new CromosomaFuncion((CromosomaFuncion)original);
		else
			return null;
	}
	@Override
	public String toString(){
		return "f(x) = 20 + e -20e^(-0,2|x|) -e^(cos2πx)  : x ∈ [0,32]";
	}


}
